<template>
  <div class="popup"
       v-if="show">
    <div class="box" :style="getPadding">
      <i class="iconfont icon-guanbi close" v-if="close"
         @click="closeClick"></i>
      <div v-if="tit"
           class="pop-title">
        {{ tit }}
      </div>

      <slot>
      </slot>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    show: {
      type: Boolean,
      default: true
    },
    tit: {
      type: String,
      default: ''
    },
    close: {
      type: Boolean,
      default: false
    },
    padding:{
      type:Number,
      default:20
    }
  },
  data() {
    return {
      myShow: true
    }
  },
  methods: {
    closeClick() {
      this.$emit('close')
    }
  },
  computed:{
    getPadding(){
      return `padding: ${this.padding}px;`

    }
  }
}
</script>

<style scoped>
.popup {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1000;
}
.box {
  width: intrinsic;
  width: -moz-max-content;
  width: -webkit-max-content;
  background: white;
  margin: auto;
  /* padding: 20px; */
  border-radius: 3px;
  margin-top: 30px;
  min-width: 300px;
  min-height: 300px;
  position: relative;
}
.pop-title {
  text-align: center;
  border-bottom: 1px #ccc solid;
  padding-bottom: 10px;
  color: #000;
}
.popup  .close {
  position: absolute;
  right: 10px;
  top: 10px;
  cursor: pointer;
  z-index: 5;
}
.popup  .close:hover {
  color: var(--color-main);
}
</style>